package com.link.base.task;

import com.link.base.base.saleactivity.service.AtyScheduledTasks;
import com.link.base.core.basic.config.xxljob.BaseLinkJobHandler;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 自动更新活动有效性
 * 每隔24小时执行一次
 *
 * @author wangdawei
 * @date 2019-03-08
 * */
@JobHandler(value = "activityJobHandler")
@Component
public class TaskSaleActivity extends BaseLinkJobHandler {

    @Resource
    private AtyScheduledTasks atyScheduledTsaks;

    @Override
    public ReturnT<String> execute(String params) throws Exception {
        try {
            XxlJobLogger.log("XXL-JOB, Hello activityJobHandler");
            super.setLogin(params);
            atyScheduledTsaks.activityTasks();
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            XxlJobLogger.log(e.getMessage());
            return ReturnT.FAIL;
        }
    }
}
